package cn.luecc.action;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.Session;

public final class HibernateUtil {
	private static SessionFactory sessionFactory;
	private HibernateUtil(){
	}
	static {
    	Configuration cfg = new Configuration();
		cfg.configure();
		sessionFactory = cfg.buildSessionFactory();
	}
	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}
	public static Session getSession(){
		System.out.println("static Session getSession called");
		return sessionFactory.openSession();
	}

}
